package cn.kgc.springcloud.client;

import cn.kgc.springcloud.entity.Order;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @author: 课工场
 * @since 2023/9/1
 */
@FeignClient("ORDERSERVICE")   //在实现服务调用时 会根据配置的服务节点的名称  到注册中心拉取节点地址+port localhost:8520
public interface OrderClient {

    // http://localhost:8520/order/m1
    @GetMapping("/order/m1")
    String method1();

    // http://localhost:8520/order/m2?id = 10     queryString
    @GetMapping("/order/m2")
    String method2(@RequestParam("id") Integer id);

    //   http://localhost:8520/order/m3/10   path
    @GetMapping("/order/m3/{id}")
    String method3(@PathVariable("id") Integer id);

    @GetMapping("/order/m4")
    String method4(@RequestParam("ids") Integer[] ids);

    //http://localhost:8520/order/m5?id=10&name=mate60
    @GetMapping("/order/m5")
    String method5(@RequestParam("id") Integer id,@RequestParam("productName")String productName);

    @PostMapping("/order/m6")
    String method6(@RequestBody Order order);

    // string  json   order
    @GetMapping("/order/m7")
    Order method7(@RequestParam("id") Integer id);
}
